<template>
	<up-button color="#64c6ae" size="large" open-type="getPhoneNumber" @getphonenumber="onGetPhoneNumber">{{ props.text }}</up-button>
</template>

<script setup>
	import useAppStore from '@/store/app.js'

	const props = defineProps({
		text: {
			type: String,
			default: '验证手机号码'
		}
	})

	const appStore = useAppStore()
	const emits = defineEmits(['onbind'])

	const hasMobile = computed(() => {
		return appStore.hasMobile
	})

	// 绑定手机号
	function onGetPhoneNumber(e) {
		appStore.bindMobile(e).then(() => {
			emits('onbind')
		})
	}
</script>